import { Component, OnInit, AfterViewInit } from '@angular/core';
import { RectBox } from './model/component-model/rect-model';
import { RoundRectBox } from './model/component-model/roundrec-model';
import { RootContainer } from './model/component-model/container-model';
import { ShapeBox } from './model/component-model/component-related/shape-box-interface';
import { BoxService } from './service/box.service';
import { SelectBox } from './model/component-model/select-box';
import { ShapeBoxBase } from './model/component-model/component-related/box-base';
import { containsTree } from '_@angular_router@5.0.2@@angular/router/src/url_tree';

@Component({
  selector: 'e-process',
  templateUrl: "./e-process.component.html",
  styleUrls: ['./e-process.component.css']
})

export class EProcessComponent {
  rootShape: ShapeBoxBase = new RootContainer(null);
  boxService: BoxService = BoxService.getService();
  mousemove(event) {
    this.boxService.move(event);
  }
  finish() {
    this.boxService.finish();
  }
  select(e){
    this.boxService.select(e);
  }
  constructor() {
    this.boxService.container = this.rootShape;
    this.rootShape.style["z-index"] = 0;
    this.rootShape.children.push(new SelectBox({
      left: 0,
      top: 0,
      width: 0,
      height: 0,
      "z-index": 3
    }));
    this.rootShape.children.push(new RectBox({
      left: 50,
      top: 50,
      width: 100,
      height: 50,
      "z-index": 1
    }));
    this.rootShape.children.push(new RoundRectBox({
      id: "2",
      left: 200,
      top: 50,
      width: 100,
      height: 50,
      "z-index": 2
    }));
  }
}
